var card =new  Object()
$("#use_card").click(function(){
	var number= $("#number").val();
	var password = $("#password").val();
	var postJsondata = {"number":number,
						"password":password
						};
	$.ajax({
	 type:'POST',
	 url:'user_userCard.htm',
	 data:postJsondata,
	 dataType: 'json',
	 success:card.response,
	 async:false
	});	
})

card.response = function(res){
	if(res.success=='success'){
		if(res.success_card.type==4){
			var times = res.success_card.lesson;
			location.href='user_cardsuccess.htm?type='+res.success_card.type+'&times='+times;
			//alert('充值成功,您已获得次卡类型套餐'+times+'次上课机会,祝您听课愉快');
		}
		if(res.success_card.type==7){
			var times = res.success_card.lesson;
			location.href='user_cardsuccess.htm?type='+res.success_card.type+'&times='+times;
			//alert('充值成功,您已获得包月类型套餐'+times+'包月卡上课机会,祝您听课愉快');
		}
		if(res.success_card.type==5){
			location.href='user_cardsuccess.htm?type='+res.success_card.type;
			//alert('充值成功,请查看账户余额');
		}
		return;
	}else{
		if(res.error_code==12){
			alert('该卡关联活动仅限新用户使用,且只能享受一次优惠,谢谢!');
		}else{
			alert('卡无效,充值失败,若有问题,请联系我们,谢谢！')
		}
		return;
	}
	
}